package com.edushare.common.mailer;


import com.edushare.common.util.URLUtils;
import com.edushare.common.vo.CourseInstances;
import com.edushare.common.vo.OutgoingEmails;
import com.edushare.common.vo.Users;

public class FacultyGradeUpdate extends MailStringLoader{
	
	
	public FacultyGradeUpdate(String gradeMsg, CourseInstances cInst, Users user, Users sender){
		replaceMap.put("FROM_USER_NAME", sender.getCompleteUserName());
		replaceMap.put("FROM_USER_URL", URLUtils.getHomePageURL(sender));
		replaceMap.put("GRADE_MSG", gradeMsg);
		replaceMap.put("ENTITY_URL", URLUtils.getHomePageURL(cInst));
		replaceMap.put("ENTITY_NAME", cInst.getName());
		
		this.user = user;
		messageString = templateParser(mailString, replaceMap);
	}
	
	private String mailString = MailBase.get().stringMap.get(MailBase.FACULTY_GRADE_UPDATE);
	private Users user;
	
	@Override
	public OutgoingEmails send() {
		OutgoingEmails mail = new OutgoingEmails();
		mail.setContent(messageString);
		mail.setReceiverEmailId(user.getEmail());
		mail.setStatus(OutgoingEmails.EMAIL_TO_BE_SENT);
		mail.setCopyType(1);
		mail.setSubject("EduShare Grades Update");
		return mail;
	}
}
